<extend name="Public/base"/>

<block name="body">
    <!-- 标题栏 -->
    <div class="main-title">
        <h2>{$meta_title}{$recycle}</h2>
    </div>
    <div class="clearfix">
        <div class="col-xs-10">
            <eq name="sort" value="normal">
            <a class="btn btn-success" href="{:U('addImpl')}">新增</a>
            <button class="btn ajax-post btn-primary" url="{:U('setStatus',array('method'=>'resume','model'=>'CoreInterface'))}"
                    target-form="ids">激活
            </button>
            <button class="btn ajax-post btn-warning" url="{:U('setStatus',array('method'=>'forbid','model'=>'CoreInterface'))}"
                    target-form="ids">禁用
            </button>
            <button class="btn ajax-post btn-danger" url="{:U('setStatus',array('method'=>'delete','model'=>'CoreInterface'))}"
                    target-form="ids">删除
            </button>

            <a class="btn" href="{:U('index',array('sort'=>'recycle'))}">回收站</a>
            
            <else/>
             <button class="btn ajax-post btn-info" url="{:U('setStatus',array('method'=>'recover','model'=>'CoreInterface'))}"
                    target-form="ids">恢复
            </button>
            <button class="btn ajax-post btn-danger" url="{:U('setStatus',array('method'=>'destory','model'=>'CoreInterface'))}"
                    target-form="ids">彻底删除
            </button>

            <a class="btn" href="{:U()}">正常模式</a>
            </eq>
        </div>
        <!-- 高级搜索 -->
        <div class="search-form  col-xs-2 text-right">
            <div class="input-group">
                <input type="text" name="keyword" class="search-input form-control" value="{:I('keyword')}" placeholder="名称/标识">
                                 <span class="input-group-btn">  <a class="btn btn-default" href="javascript:;" id="search" url="{:U('index')}"><i class="icon-search"></i></a></span>
            </div>
        </div>
    </div>
    <!-- 数据列表 -->
    <div class="data-table with-padding">
        <table class="table table-bordered table-striped ">
            <thead>
            <tr>
                <th class="row-selected row-selected"><input class="check-all" type="checkbox"/></th>
                <th class="">名称</th>
                <th class="">标识</th>
                <th class="">类型</th>
                <th class="">备注</th>
                <th class="">状态</th>
                <th class="">创建</th>
                <th class="">更新</th>
                <th class="">排序</th>
                <th class="">操作</th>
            </tr>
            </thead>
            <tbody>
            <notempty name="_list">
                <volist name="_list" id="vo">
                    <tr>
                        <td><input class="ids" type="checkbox" name="id[]" value="{$vo.id}"/></td>
                        <td>{$vo.title}</td>
                        <td>{$vo.sign}</td>
                        <td>{$vo.type_name}</td>
                        <td>{$vo.remark}</td>
                        <td>
                            <eq name="vo.status" value="-1"><a class="status status_4">删除</a></eq>
                            <eq name="vo.status" value="0"><a class="status status_3">未激活</a></eq>
                            <eq name="vo.status" value="1"><a class="status status_2">启用</a></eq>
                            <eq name="vo.status" value="2"><a class="status status_4">禁用</a></eq>
                        </td>
                        <td>{$vo.create_time|time_format}</td>
                        <td><notempty name="vo[updatetime]">{$vo.update_time|time_format}</notempty></td>
                        <td>{$vo.sort}</td>
                        <td>
                        <eq name="sort" value="normal">
                            <a class="status status_1" href="{:U('editImpl',array('id'=>$vo[id]))}">编辑</a>
                            <if condition="$vo.status neq 1">
                            <a class="status status_2 ajax-get" href="{:U('setStatus',array('method'=>'resume',id=>$vo[id],'model'=>'CoreInterface'))}">激活</a>
                            </if>
                            <if condition="$vo.status neq 2">
                            <a class="status status_4 ajax-get" href="{:U('setStatus',array('method'=>'forbid',id=>$vo[id],'model'=>'CoreInterface'))}">禁用</a>
                            </if>
                            <a class="status status_4 ajax-get" href="{:U('setStatus',array('method'=>'delete',id=>$vo[id],'model'=>'CoreInterface'))}">删除</a>
                        <else />
                            <a class="status status_3 ajax-get" href="{:U('setStatus',array('method'=>'recover',id=>$vo[id],'model'=>'CoreInterface'))}">恢复</a>
                            <a class="status status_4 ajax-get" href="{:U('setStatus',array('method'=>'destory',id=>$vo[id],'model'=>'CoreInterface'))}">彻底删除</a>
                        </eq>
                        </td>
                    </tr>
                </volist>
                <else/>
                <td colspan="10" class="text-center">{:L('_ADMIN_USER_EMPTY_')}</td>
            </notempty>
            </tbody>
        </table>
    </div>
    <div class="with-padding">
        {$_page}
    </div>
</block>

<block name="script">
    <script src="__CSS__/status.css"></script>
    <script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>
    
    <script type="text/javascript">
        //搜索功能
        $("#search").click(function () {
            var url = $(this).attr('url');
            var query = $('.search-form').find('input').serialize();
            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
            query = query.replace(/^&/g, '');
            if (url.indexOf('?') > 0) {
                url += '&' + query;
            } else {
                url += '?' + query;
            }
            window.location.href = url;
        });
        //回车搜索
        $(".search-input").keyup(function (e) {
            if (e.keyCode === 13) {
                $("#search").click();
                return false;
            }
        });
        //导航高亮
        highlight_subnav("{:U('index')}");
    </script>
</block>